package com.soso.base.google.hessian;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.caucho.hessian.server.HessianServlet;

/**
 * 
 * @author speed
 * 
 */
@SuppressWarnings("serial")
public abstract class BaseHessianMapServlet extends HessianServlet {

	public void init(ServletConfig config) throws ServletException {
		setHessianService();
		super.init(config);
	}

	public void service(ServletRequest request, ServletResponse response)
			throws IOException, ServletException {
		setHessianService();
		super.service(request, response);
	}
	protected  void setHessianService(){
		HessianMap hessianMap = getHessianMap();
		setHome(hessianMap.getHomeImpl());
		setHomeAPI(hessianMap.getHomeAPI());
	}
	protected abstract HessianMap getHessianMap();
}
